<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="../../resources/templates/login.xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:sec="http://www.springframework.org/security/facelets/tags" >

    <ui:define name="menu_horizontal">
        <sec:ifAnyGranted roles="ROLE_SERVIDOR,ROLE_ADMINISTRADOR">
            <ui:include src="/site/acessoServidor/menu.xhtml" />
        </sec:ifAnyGranted>
    </ui:define>
    
    <ui:define name="corpo">

        <sec:ifAnyGranted roles="ROLE_SERVIDOR,ROLE_ADMINISTRADOR">
            
            <h:form>
                
                <p:panel>
                    <p:commandButton value="NOVA ENTRADA" actionListener="#{controllerPonto.entrada()}" update="@form" rendered="#{empty controllerPonto.verificaData()}"/>
                </p:panel>
                <p:dataTable id="tabela" var="p" value="#{controllerPonto.listaDM}" emptyMessage="Não há resultados para hoje.">
                    <!-- ENTRADA MATUTINA  -->
                    <p:column headerText="Entrada Matutina" rendered="#{p.entrada_matutina != null}">
                        <h:outputText value="#{p.entrada_matutina}">
                            <f:convertDateTime pattern="HH:mm:ss" timeZone="GMT-03:00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Entrada Matutina" rendered="#{p.entrada_matutina == null}">
                        <p:commandButton value="ENTRADA MATUTINA" actionListener="#{controllerPonto.entradaMatutina()}" update="@form"/>
                    </p:column>
                    <!-- SAIDA MATUTINA  -->
                    <p:column headerText="Saída Matutina" rendered="#{p.saida_matutina != null}">
                        <h:outputText value="#{p.saida_matutina}">
                            <f:convertDateTime pattern="HH:mm:ss" timeZone="GMT-03:00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Saída Matutina" rendered="#{p.saida_matutina == null}">
                        <p:commandButton value="SAÍDA MATUTINA" actionListener="#{controllerPonto.saidaMatutina()}" update="@form"/>
                    </p:column>
                    <!-- ENTRADA VESPERTINA  -->
                    <p:column headerText="Entrada Vespertina" rendered="#{p.entrada_vespertina != null}">
                        <h:outputText value="#{p.entrada_vespertina}">
                            <f:convertDateTime pattern="HH:mm:ss" timeZone="GMT-03:00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Entrada Vespertina" rendered="#{p.entrada_vespertina == null}">
                        <p:commandButton value="ENTRADA VESPERTINA" actionListener="#{controllerPonto.entradaVespertina()}" update="@form"/>
                    </p:column>
                    <!-- SAIDA VESPERTINA  -->
                    <p:column headerText="Saída Vespertina" rendered="#{p.saida_vespertina != null}">
                        <h:outputText value="#{p.saida_vespertina}">
                            <f:convertDateTime pattern="HH:mm:ss" timeZone="GMT-03:00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Saída Vespertina" rendered="#{p.saida_vespertina == null}">
                        <p:commandButton value="ENTRADA VESPERTINA" actionListener="#{controllerPonto.saidaVespertina()}" update="@form"/>
                    </p:column>
                    <!-- ENTRADA NOTURNA  -->
                    <p:column headerText="Entrada Noturna" rendered="#{p.entrada_noturna != null}">
                        <h:outputText value="#{p.entrada_noturna}">
                            <f:convertDateTime pattern="HH:mm:ss" timeZone="GMT-03:00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Entrada Noturna" rendered="#{p.entrada_noturna == null}">
                        <p:commandButton value="ENTRADA NOTURNA" actionListener="#{controllerPonto.entradaNoturna()}" update="@form"/>
                    </p:column>
                    <!-- SAIDA NOTURNA  -->
                    <p:column headerText="Saída Noturna" rendered="#{p.saida_noturna != null}">
                        <h:outputText value="#{p.saida_noturna}">
                            <f:convertDateTime pattern="HH:mm:ss" timeZone="GMT-03:00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Saída Noturna" rendered="#{p.saida_noturna == null}">
                        <p:commandButton value="SAÍDA NOTURNA" actionListener="#{controllerPonto.saidaNoturna()}" update="@form"/>
                    </p:column>
                </p:dataTable>

                              
            </h:form>
            
        </sec:ifAnyGranted>
        
    </ui:define>
    
</ui:composition>
